#include <stdlib.h>
#include <stdio.h>

#define GET_BITS(x, shift, size) (((x) >>(shift)) & (((1 << (size)) - 1))) 

typedef struct test_struct_tag
{
	unsigned char a:3;
	unsigned char b:3;
	unsigned char c:2;
}TS;

int main()
{
	int i;
	TS s1;
	s1.a = 4;
	s1.b = 4;
	s1.c = 2;

	/*
	for(i=0;i<8;i++)
	{
		printf("%d\n",GET_BITS((unsigned char)s1,i,1));
	}
	*/

	printf("s1.a=%d\n",s1.a);
	printf("s1.b=%d\n",s1.b);
	printf("s1.c=%d\n",s1.c);

	for(i=0;i<8;i++)
	{
		printf("%d\t",((((unsigned char)s1)>>i)&1));
	}

}
